﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Chowpoo.Sql;

namespace CourseSystem.Core.Entities
{
    [Table(Name = "CourseSetting")]
    public class CourseSettingInfo : IDetach
    {
        public CourseSettingInfo()
        {
            Detach();
        }
        #region Model
        private int _id;
        private string _coursecode = "";
        private string _coursename = "";
        private string _teacher = "";
        private string _loginimglogo = "";
        private string _loginimgleft = "";
        private string _loginedimgtop = "";
        private string _adminimgtop = "";
        private int _todayiphits = 0;
        private int _todayhits = 0;
        private int _maxonline = 0;
        private int _courseguideId = 0;
        private int _coursehelperId = 0;
        private int _hits = 0;
        private int _studentHours = 0;
        private int _teacherHours = 0;
        private int _homeworkpersan = 0;
        private int _exampersan = 0;
        private int _questionpersan = 0;
        private int _postpersan = 0;
        private string _questionstate = "";
        private string _poststate = "";

        private EntityRef<CommonContentInfo> _commonContentInfo;

        [System.Data.Linq.Mapping.Association(Storage = "_commonContentInfo", ThisKey = "CourseGuideId", OtherKey = "Id", IsForeignKey = true)]
        [XmlIgnore]
        public CommonContentInfo CourseGuideInfo
        {
            get { return _commonContentInfo.Entity; }
            set { _commonContentInfo.Entity = value; }
        }

        private EntityRef<CommonContentInfo> _helpcommonContentInfo;

        [System.Data.Linq.Mapping.Association(Storage = "_helpcommonContentInfo", ThisKey = "CourseHelperId", OtherKey = "Id", IsForeignKey = true)]
        [XmlIgnore]
        public CommonContentInfo CourseHelpInfo
        {
            get { return _helpcommonContentInfo.Entity; }
            set { _helpcommonContentInfo.Entity = value; }
        }


        /// <summary>
        /// 
        /// </summary>
        [Column(IsDbGenerated = true, IsPrimaryKey = true, IsVersion = true)]
        public int Id
        {
            set { _id = value; }
            get { return _id; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("课程编号")]
        [Required(ErrorMessage = "必须填写")]
        public string CourseCode
        {
            set { _coursecode = value; }
            get { return _coursecode; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("课程名称")]
        [Required(ErrorMessage = "必须填写")]
        public string CourseName
        {
            set { _coursename = value; }
            get { return _coursename; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("负责老师")]
        public string Teacher
        {
            set { _teacher = value; }
            get { return _teacher; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("登录页面顶部图片(800*158,jpg,jpeg,gif,png)")]
        public string LoginImgLogo
        {
            set { _loginimglogo = value; }
            get { return _loginimglogo; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("登录页面左边图片(401*439,jpg,jpeg,gif,png)")]
        public string LoginImgLeft
        {
            set { _loginimgleft = value; }
            get { return _loginimgleft; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("登录系统后顶部图片(1000*168,jpg,jpeg,gif,png)")]
        public string LoginedImgTop
        {
            set { _loginedimgtop = value; }
            get { return _loginedimgtop; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("管理页面顶部图片(1000*82,jpg,jpeg,gif,png)")]
        public string AdminImgTop
        {
            set { _adminimgtop = value; }
            get { return _adminimgtop; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("今天访问量(IP)")]
        public int TodayIpHits
        {
            set { _todayiphits = value; }
            get { return _todayiphits; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("今天访问量(点击)")]
        public int TodayHits
        {
            set { _todayhits = value; }
            get { return _todayhits; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("峰值在线")]
        public int MaxOnline
        {
            set { _maxonline = value; }
            get { return _maxonline; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("导航")]
        public int CourseGuideId
        {
            set { _courseguideId = value; }
            get { return _courseguideId; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("课程使用帮助")]
        public int CourseHelperId
        {
            set { _coursehelperId = value; }
            get { return _coursehelperId; }
        }


        [Column]
        public int Hits
        {
            get { return _hits; }
            set { _hits = value; }
        }

        [Column]
        [DisplayName("学生总学时")]
        public int StudentHours
        {
            get { return _studentHours; }
            set { _studentHours = value; }
        }

        [Column]
        [DisplayName("教师总教学时数")]
        public int TeacherHours
        {
            get { return _teacherHours; }
            set { _teacherHours = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("章节练习总成绩/（章节习题集数+作业次数）占比")]
        public int HomeworkPersan
        {
            set { _homeworkpersan = value; }
            get { return _homeworkpersan; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("考试成绩占比")]
        public int ExamPersan
        {
            set { _exampersan = value; }
            get { return _exampersan; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("提问情况占比")]
        public int QuestionPersan
        {
            set { _questionpersan = value; }
            get { return _questionpersan; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("讨论情况占比")]
        public int PostPersan
        {
            set { _postpersan = value; }
            get { return _postpersan; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("提问情况(0:0;10:30;20:60;30:100)")]
        [Required(ErrorMessage = "必须填写")]
        public string QuestionState
        {
            set { _questionstate = value; }
            get { return _questionstate; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("讨论情况(0:0;10:30;20:60;30:100)")]
        [Required(ErrorMessage = "必须填写")]
        public string PostState
        {
            set { _poststate = value; }
            get { return _poststate; }
        }
        #endregion Model

        public void Detach()
        {
            this._commonContentInfo = default(EntityRef<CommonContentInfo>);
            this._helpcommonContentInfo = default(EntityRef<CommonContentInfo>);
        }
    }
}
